Skip to content

fix(init): show actionable error when org is over its member limit#1091

Merged
betegon merged 1 commit into
mainfrom
fix/init-over-member-limit-error
Jun 11, 2026
Merged

fix(init): show actionable error when org is over its member limit#1091
betegon merged 1 commit into
mainfrom
fix/init-over-member-limit-error

Conversation

@betegon

@betegon betegon commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

When you run sentry init against an org that's over its member limit, Sentry disables your seat and returns 401 member-disabled-over-limit on region-scoped calls (like listing teams). Init resolved the org fine from the control-plane org list, then hit that 401 during team resolution and showed a bare:

✖  Setup failed.
   Failed to list teams
   401

The generic 401 path also told the user to re-authenticate — useless here, since it's a billing/seat issue, not auth. Found while triaging a real init failure against an over-limit EU org.

Changes

  • enrich401Detail recognizes the member-disabled-over-limit code and explains the real cause (org over member limit; ask an owner to upgrade or free a seat, or target another org) instead of the misleading re-auth advice.
  • The init team-resolution paths (implicit and explicit) now surface the ApiError's enriched detail via format() rather than flattening it to error.message, and resolve-team's handleListTeamsError re-throws 401s as ApiError so the detail survives. This mirrors the existing 401 handling for listOrganizations (fix(init): enrich 401 Unauthorized errors with actionable guidance #971).

After:

Failed to list teams: 401
  Your account is disabled in this organization because it is over its member limit.
  This is a billing/seat-limit issue, not an auth problem — re-authenticating won't help.
  Ask an org owner to upgrade the plan or free up a seat, then retry.
  Or target a different org, e.g.:  sentry init my-other-org/

Test Plan

  • New unit tests: infrastructure.test.ts (member-limit 401 message, and that it doesn't suggest re-auth) and preflight.test.ts (implicit listTeams 401 surfaces the detail).
  • pnpm test green, lint + tsc --noEmit clean.
  • Verified end-to-end against a real over-limit org: sentry team list <org>/ and sentry init <org>/ both print the new guidance and fail before writing any files.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1091/

Built to branch gh-pages at 2026-06-11 15:16 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5016 uncovered lines.
✅ Project coverage is 81.18%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/resolve-team.ts 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.17%    81.18%    +0.01%
==========================================
  Files          383       383         —
  Lines        26640     26649        +9
  Branches     17338     17340        +2
==========================================
+ Hits         21623     21633       +10
- Misses        5017      5016        -1
- Partials      1798      1800        +2

Generated by Codecov Action

@betegon betegon marked this pull request as ready for review June 11, 2026 11:24
Comment thread src/lib/api/infrastructure.ts
@betegon betegon force-pushed the fix/init-over-member-limit-error branch from dd0af53 to 1f2aac5 Compare June 11, 2026 11:31
When the target org is over its member limit, Sentry disables the
caller's seat and returns 401 `member-disabled-over-limit` for
region-scoped calls like listing teams. `sentry init` resolved the org
fine from the control-plane org list, then hit this 401 during team
resolution and surfaced a bare "Failed to list teams / 401" — and the
generic 401 path told the user to re-authenticate, which can't fix a
seat-limit lockout.

Recognize the code in enrich401Detail and explain the real cause (org
over member limit, ask an owner to upgrade/free a seat, or use another
org). Preserve the enriched detail through the init team-resolution
paths (implicit and explicit) and resolve-team's 401 handling so the
guidance reaches the user instead of being flattened.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@betegon betegon force-pushed the fix/init-over-member-limit-error branch from 1f2aac5 to 0af1566 Compare June 11, 2026 15:13
@betegon betegon merged commit a55d2a8 into main Jun 11, 2026
29 checks passed
@betegon betegon deleted the fix/init-over-member-limit-error branch June 11, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant